package com.citygis.transferdata.tools;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * @ClassName: InitSysLoad 
 * @Description: TODO 系统启动加载配置文件配置类(InitSysLoad.属性名)
 * @author: liuzg
 * @Date: 2021/8/31 9:53
 * @Version: v1.0
 */
@Component
public class InitSysLoad implements InitializingBean {

    // ************  从配置yml中读取配置  ************
    @Value("${server.port}")
    private String port;

    @Value("${config.existTime}")
    private String existTime;

    @Value("${config.source2Name}")
    private String source2Name;

    @Value("${config.existDate}")
    private String existDate;

    @Value("${config.allPush}")
    private String allPush;

    @Value("${config.thisMedia}")
    private String mediaTables;

//    @Value("${config.sTcTaskMediaSql}")
//    private String sTcTaskMediaSql;
//
//    @Value("${config.tcDetailMediaSql}")
//    private String tcDetailMediaSql;
//
//    @Value("${config.wlTaskMediaSql}")
//    private String wlTaskMediaSql;
//
//    @Value("${config.sqlEnd}")
//    private String sqlEnd;



    // ********** 将读取到的配置赋值给静态变量 ***********
    public static String PORT; // 端口号
    public static String EXISTTIME;
    public static String SOURCE2NAME;
    public static String EXISTDATE;
    public static String ALLPUSH;
    public static String MEDIATABLES;
//    public static String STCTASKMEDIASQL;
//    public static String TCDETAILMEDIASQL;
//    public static String WLTASKMEDIASQL;
//    public static String SQLEND;

    @Override
    public void afterPropertiesSet() throws Exception {
        PORT = port;
        EXISTTIME = existTime;
        SOURCE2NAME = source2Name;
        EXISTDATE = existDate;
        ALLPUSH = allPush;
        MEDIATABLES = mediaTables;
//        STCTASKMEDIASQL = sTcTaskMediaSql;
//        TCDETAILMEDIASQL = tcDetailMediaSql;
//        WLTASKMEDIASQL = wlTaskMediaSql;
//        SQLEND = sqlEnd;
    }
}
